package com.joysuch.wwyt.dzhapi.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joysuch.wwyt.api.base.dto.ApiDepartDto;
import com.joysuch.wwyt.dzhapi.bean.ApiBpDepartBean;

import java.util.List;

/**
 * @author zero
 * @since 2021/11/2 14:18
 */
public interface ApiBpDepartMapper extends BaseMapper<ApiBpDepartBean> {
    ApiBpDepartBean findFirstByNameAndCurrentCompany(String depart, String orgCode, Long tenentId);

    ApiBpDepartBean getFatherDepart(String orgCode, Long tenentId);

    List<ApiBpDepartBean> findLikeCode(String code, Long tenentId, String orgCode);

    ApiBpDepartBean findByUniqueId(String unqiueId, Long tenentId, String orgCode);

    List<ApiBpDepartBean> findByParentId(Long parentId, Long tenentId, String orgCode);

    int countByCodeAndState(String code, Long tenentId, String orgCode);

    List<Long> findIdByByParentId(Long parentId, Long tenentId, String orgCode);

    ApiBpDepartBean findByIdAndStatus(Long id, Long tenentId, String orgCode);

    List<ApiBpDepartBean> findByParentIsNull(Long tenentId, String orgCode);

    List<ApiDepartDto> getListForApi(String departName, String departCode, Long tenentId, String orgCode);

    Page<ApiDepartDto> getListByPageForApi(Page pageForApi, String departName, String departCode, Long tenentId, String orgCode);

    List<ApiDepartDto> findListByChiefId(Long chiefId, Long tenentId, String orgCode);
}
